const domain = "https://api.it120.cc/small4/";

function http({ url, method = "GET", data = {}, header = {} }) {
  //导航栏显示loading
  wx.showNavigationBarLoading()
  return new Promise((resolve, reject) => {
    wx.request({
      url: domain + url,
      header,
      method,
      data,
      success: (res) => {
        wx.hideNavigationBarLoading()     //隐藏导航栏loading效果
        resolve(res);
      },
      fail: (err) => {

        reject(err);
      },
    });
  });
}

export { http, domain };
